function play( avi )
% plays( avi ) movie using player

global player_timer;
global play_movie;

play_movie = avi;
player( @play_init, @play_frame, 0 );

% ---------- init method -----------
function play_init( P )

global player_frames player_caching play_movie play_counter;

player_frames = size( play_movie, 2 );
player_caching = 0;
play_counter = text( 10, 25, 'frame:', 'BackgroundColor', [1 1 1] );

% zoom smaller movies
if size( play_movie(1).cdata, 2 ) <= 80
	a = gca;
	set( a, 'DataAspectRatioMode', 'auto' );
	set( a, 'XLimMode', 'auto' );
	set( a, 'YLimMode', 'auto' );
	
	set( play_counter, 'Position', [ 1 1] );
end

% --------- frame display method -------
function play_frame( P )

global player_current_frame player_image;
global play_movie play_counter;

% spawns new image each call!
%image( play_movie( player_current_frame ).cdata );
set( player_image, 'CData', play_movie( player_current_frame ).cdata );
% slow!
%text( 10, 25, num2str( player_current_frame ), 'BackgroundColor', [1 1 1] );
set( play_counter, 'String', sprintf( 'frame: %.0f', player_current_frame ) );
